package chapter3.lc11;

//LC 11 盛水最多的容器

/**
 * 双指针往中间夹
 */
public class ContainerWithMostWater {
    public int maxArea(int[] height) {
        int maxArea = 0;
        for (int i = 0, j = height.length -1; i < j ;) {
            maxArea = Math.max(maxArea, Math.min(height[i], height[j]) * (j - i));
            if (height[i] < height[j]) {
                i++;
            }else {
                j--;
            }
        }
        return maxArea;
    }
}
